/**
 * Created by xwang on 2018-07-09.
 */
var request = require("superagent");
var API = require("./support/const");
var service = require("../../service/log");


/**
 * 检查项分析
 * **/
exports.inspectItem = {
    list: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.inspect_item)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getList', 'msg': '获取检查项分析列表'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },

    compareCorrective: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.compare_corrective)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getList', 'msg': '整改统计列表'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    compareCorrectiveExportExecl: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.compare_corrective_export_excel)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getId', 'msg': '整改统计导出表格'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    compareCollege: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.compare_college)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getList', 'msg': '学校对比列表'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    compareCollegeExportExcel: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.compare_college_excel)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getId', 'msg': '学校对比导出表格'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    compareInspectItem: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.compare_inspect_item)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getList', 'msg': '检查项对比列表'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    compareInspectItemExcel: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.compare_inspect_item_excel)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getId', 'msg': '检查项对比导出表格'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    getCollegeSummary: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.college_summary)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getList', 'msg': '学院概况列表'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    exportCollegeSummaryExcel: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.college_summary_excel)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getId', 'msg': '学院概况导出'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    getCollegeSummaryOvercomplete: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.college_summary_overcomplete)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getList', 'msg': '基本信息完善情况列表'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    exportCollegeSummaryOvercompleteExcel: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.college_summary_overcomplete_excel)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getId', 'msg': '基本信息完善情况导出基本信息完善情况'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    fullOrPart: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.full_or_part)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getList', 'msg': '专职兼职人员统计'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    economics: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.economics)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getList', 'msg': '经费投入概况'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    baseBuild: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.base_build)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getList', 'msg': '基础设施统计'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    },
    checkOverAllProcess: function (req, res, next) {
        let header = {
            token: req.cookies.token
        };
        request.get(API.statistics.check_over_all_process)
            .set(header)
            .query({msg: JSON.stringify(req.body)})
            .end(function (_req, _res) {
                if (_res.status === 200) {
                    service.save_user_log({'type': 'getList', 'msg': '检查全过程统计'}, req);
                }
                res.json(JSON.parse(_res.text));
            });
    }
}
